{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Azure\n",
    "import requests\n",
    "import json\n",
    "faceListId =  \"api_faceidlists\"\n",
    "create_facelists_url =  \"https://api-ljh.cognitiveservices.azure.com/face/v1.0/facelists/{}\"\n",
    "subscription_key = \"d1db9f53fddd42c3a03669ff7b93dad8\"\n",
    "assert subscription_key\n",
    "\n",
    "headers = {\n",
    "    'Content-Type': 'application/json',\n",
    "    'Ocp-Apim-Subscription-Key': subscription_key,\n",
    "}\n",
    "data = {\n",
    "    \"name\": \"chenying\",\n",
    "    \"userData\": \"陈颖\",\n",
    "    \"recognitionModel\": \"recognition_03\", \n",
    "\n",
    "}\n",
    "\n",
    "r_create = requests.put(create_facelists_url.format(faceListId),headers=headers, json=data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "b'{\"error\":{\"code\":\"FaceListExists\",\"message\":\"Face list \\'api_faceidlists\\' already exists.\"}}'"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r_create.content"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "200"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# (1).添加人脸\n",
    "add_face_url =\"https://api-ljh.cognitiveservices.azure.com/face/v1.0/facelists/{}/persistedfaces\"\n",
    "assert subscription_key\n",
    "headers = {\n",
    "    'Content-Type': 'application/json',\n",
    "    'Ocp-Apim-Subscription-Key': subscription_key,\n",
    "}\n",
    "# 人脸相片地址\n",
    "img_url =\"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fnimg.ws.126.net%2F%3Furl%3Dhttp%253A%252F%252Fdingyue.ws.126.net%252F2021%252F0105%252F5b4bda89j00qmfm6t0010c000h200cfc.jpg%26thumbnail%3D650x2147483647%26quality%3D80%26type%3Djpg&refer=http%3A%2F%2Fnimg.ws.126.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1614424201&t=7563256ba4103a3e9df65762ac90ebfe\"\n",
    "# 人脸数据\n",
    "params_add_face={\n",
    "    \"userData\":\"chen\"\n",
    "}\n",
    "# 发送请求\n",
    "r_add_face = requests.post(add_face_url.format(faceListId),headers=headers,params=params_add_face,json={\"url\":img_url})\n",
    "r_add_face.status_code"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'persistedFaceId': 'fc3743bd-5d6d-4707-b21d-89e29f564f0e'}"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r_add_face.json() # 返回persistedFaceId"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 封装成函数方便添加图片\n",
    "def AddFace(img_url=str,userData=str):\n",
    "    add_face_url =\"https://api-ljh.cognitiveservices.azure.com/face/v1.0/facelists/{}/persistedFaces\"\n",
    "    assert subscription_key\n",
    "    headers = {\n",
    "        # Request headers\n",
    "        'Content-Type': 'application/json',\n",
    "        'Ocp-Apim-Subscription-Key': subscription_key,\n",
    "    }\n",
    "    img_url = img_url\n",
    "    params_add_face={\n",
    "        \"userData\":userData\n",
    "    }\n",
    "    r_add_face = requests.post(add_face_url.format(faceListId),headers=headers,params=params_add_face,json={\"url\":img_url})\n",
    "    return r_add_face.status_code #返回出状态码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "200"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "AddFace(\"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201806%2F08%2F20180608112428_mgbjr.jpeg&refer=http%3A%2F%2Fb-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1614428316&t=e7577a738e6def62c8b2e2ec6aa78564\",\"宋宋\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'faceId': '06543341-9508-499d-bc76-a197c93b3141',\n",
       "  'faceRectangle': {'top': 67, 'left': 192, 'width': 212, 'height': 212},\n",
       "  'faceAttributes': {'smile': 0.0,\n",
       "   'headPose': {'pitch': -7.1, 'roll': -9.3, 'yaw': 22.6},\n",
       "   'gender': 'female',\n",
       "   'age': 20.0,\n",
       "   'facialHair': {'moustache': 0.0, 'beard': 0.0, 'sideburns': 0.0},\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.0,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.0,\n",
       "    'neutral': 0.998,\n",
       "    'sadness': 0.001,\n",
       "    'surprise': 0.0},\n",
       "   'blur': {'blurLevel': 'low', 'value': 0.0},\n",
       "   'exposure': {'exposureLevel': 'goodExposure', 'value': 0.58},\n",
       "   'noise': {'noiseLevel': 'low', 'value': 0.0},\n",
       "   'makeup': {'eyeMakeup': True, 'lipMakeup': True},\n",
       "   'accessories': [],\n",
       "   'occlusion': {'foreheadOccluded': False,\n",
       "    'eyeOccluded': False,\n",
       "    'mouthOccluded': False},\n",
       "   'hair': {'bald': 0.08,\n",
       "    'invisible': False,\n",
       "    'hairColor': [{'color': 'brown', 'confidence': 0.99},\n",
       "     {'color': 'black', 'confidence': 0.92},\n",
       "     {'color': 'red', 'confidence': 0.16},\n",
       "     {'color': 'gray', 'confidence': 0.16},\n",
       "     {'color': 'blond', 'confidence': 0.14},\n",
       "     {'color': 'other', 'confidence': 0.14},\n",
       "     {'color': 'white', 'confidence': 0.0}]}}}]"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Detect 检测人脸的id\n",
    "# replace <My Endpoint String> with the string from your endpoint URL\n",
    "face_api_url = 'https://api-ljh.cognitiveservices.azure.com/face/v1.0/detect'\n",
    "\n",
    "# 请求正文\n",
    "image_url = 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3403073521,3211226630&fm=26&gp=0.jpg'\n",
    "\n",
    "headers = {'Ocp-Apim-Subscription-Key': subscription_key}\n",
    "\n",
    "# 请求参数\n",
    "params = {\n",
    "    'returnFaceId': 'true',\n",
    "    'returnFaceLandmarks': 'false',\n",
    "    # 选择model\n",
    "    'recognitionModel':'recognition_03',#此参数需与facelist参数一致\n",
    "    'detectionModel':'detection_01',\n",
    "    # 可选参数,请仔细阅读API文档\n",
    "    'returnFaceAttributes': \"age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise\",\n",
    "}\n",
    "\n",
    "response = requests.post(face_api_url, params=params,\n",
    "                         headers=headers, json={\"url\": image_url})\n",
    "# json.dumps 将json--->字符串\n",
    "response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'persistedFaces': [{'persistedFaceId': '9af8f330-0c38-43dc-adf4-5a99e243b182',\n",
       "   'userData': 'chen'},\n",
       "  {'persistedFaceId': '2125a194-edb0-476e-b562-2eff2b2b4b79',\n",
       "   'userData': '宋宋'},\n",
       "  {'persistedFaceId': '9ecd03ee-5ef0-4334-a19e-cae7e7fb459f',\n",
       "   'userData': 'chen'},\n",
       "  {'persistedFaceId': 'a26dbfed-916b-4202-897e-a063ad2babfb',\n",
       "   'userData': '宋宋'},\n",
       "  {'persistedFaceId': 'fc3743bd-5d6d-4707-b21d-89e29f564f0e',\n",
       "   'userData': 'chen'},\n",
       "  {'persistedFaceId': '7b6f9a3e-7454-4ba4-b372-ad34fca6b7bb',\n",
       "   'userData': '宋宋'}],\n",
       " 'faceListId': 'api_faceidlists',\n",
       " 'name': 'chenying',\n",
       " 'userData': '陈颖'}"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看列表\n",
    "get_facelist_url = \"https://api-ljh.cognitiveservices.azure.com/face/v1.0/facelists/{}\"\n",
    "r_get_facelist = requests.get(get_facelist_url.format(faceListId),headers=headers)\n",
    "r_get_facelist.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 删除人脸/人脸列表\n",
    "faceListId = \"list_004\" # 需要删除的人脸列表\n",
    "# 删除列表内人脸\n",
    "delete_face_url = \"https://api-ljh.cognitiveservices.azure.com/face/v1.0/facelists/{}/persistedfaces/{}\"\n",
    "assert subscription_key\n",
    "# 获取上面的persistedFaceId\n",
    "persistedFaceId = r_add_face.json()[\"persistedFaceId\"] \n",
    "headers = {\n",
    "    'Content-Type': 'application/json',\n",
    "    'Ocp-Apim-Subscription-Key': subscription_key,\n",
    "}\n",
    "# 注意requests请求为delete\n",
    "r_delete_face = requests.delete(delete_face_url.format(faceListId,persistedFaceId),headers=headers)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 删除人脸列表\n",
    "delete_facelist_url = \"https://api-ljh.cognitiveservices.azure.com/face/v1.0/facelists/{}\"\n",
    "assert subscription_key\n",
    "headers = {\n",
    "    'Content-Type': 'application/json',\n",
    "    'Ocp-Apim-Subscription-Key': subscription_key,\n",
    "}\n",
    "r_delete_facelist = requests.delete(delete_facelist_url.format(faceListId),headers=headers)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "200"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# face++\n",
    "# 1.先导入需要的模块\n",
    "import requests\n",
    "\n",
    "# 2.输入我们api_secret、api_key\n",
    "api_secret = \"khpW_PQQn7DjpDvL4JDDx2sJnwW47941\"\n",
    "api_key = 'uOKbPAO1um1wo1AE6aLssP6Qr3AkWYB_'\n",
    "\n",
    "# 3.目标url\n",
    "# 这里也可以使用本地图片 例如：filepath =\"image/tupian.jpg\"\n",
    "BASE_URL = 'https://api-cn.faceplusplus.com/facepp/v3/detect' \n",
    "img_url = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fnimg.ws.126.net%2F%3Furl%3Dhttp%253A%252F%252Fdingyue.ws.126.net%252F2021%252F0105%252F5b4bda89j00qmfm6t0010c000h200cfc.jpg%26thumbnail%3D650x2147483647%26quality%3D80%26type%3Djpg&refer=http%3A%2F%2Fnimg.ws.126.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1614424201&t=7563256ba4103a3e9df65762ac90ebfe'\n",
    "# 4.沿用API文档的示范代码,准备我们的headers和图片(数据)\n",
    "headers = {\n",
    "    'Content-Type': 'application/json',\n",
    "}\n",
    "\n",
    "# 5.准备后面的数据\n",
    "payload = {\n",
    "    \"image_url\":img_url,\n",
    "    'api_key': api_key,\n",
    "    'api_secret': api_secret,\n",
    "    # 是否检测并返回根据人脸特征判断出的年龄、性别、情绪等属性。\n",
    "    'return_attributes':'gender,age,smiling,emotion', \n",
    "}\n",
    "r = requests.post(BASE_URL, params=payload, headers=headers)\n",
    "r.status_code"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "b'{\"request_id\":\"1611838180,f5d88abc-2979-42e8-8471-7180c068fa7e\",\"time_used\":187,\"faces\":[{\"face_token\":\"baaa4cf192306f7113cd2d6f1827c0aa\",\"face_rectangle\":{\"top\":108,\"left\":274,\"width\":179,\"height\":179},\"attributes\":{\"gender\":{\"value\":\"Female\"},\"age\":{\"value\":22},\"smile\":{\"value\":56.583,\"threshold\":50.000},\"emotion\":{\"anger\":0.354,\"disgust\":0.068,\"fear\":0.068,\"happiness\":15.257,\"neutral\":70.400,\"sadness\":13.785,\"surprise\":0.068}}}],\"image_id\":\"1r8Vbv7G74hBBdUl3bQe3A==\",\"face_num\":1}\\n'"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.content"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'request_id': '1611838180,f5d88abc-2979-42e8-8471-7180c068fa7e',\n",
       " 'time_used': 187,\n",
       " 'faces': [{'face_token': 'baaa4cf192306f7113cd2d6f1827c0aa',\n",
       "   'face_rectangle': {'top': 108, 'left': 274, 'width': 179, 'height': 179},\n",
       "   'attributes': {'gender': {'value': 'Female'},\n",
       "    'age': {'value': 22},\n",
       "    'smile': {'value': 56.583, 'threshold': 50.0},\n",
       "    'emotion': {'anger': 0.354,\n",
       "     'disgust': 0.068,\n",
       "     'fear': 0.068,\n",
       "     'happiness': 15.257,\n",
       "     'neutral': 70.4,\n",
       "     'sadness': 13.785,\n",
       "     'surprise': 0.068}}}],\n",
       " 'image_id': '1r8Vbv7G74hBBdUl3bQe3A==',\n",
       " 'face_num': 1}"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# requests 巧妙的方法   r = response\n",
    "results = r.json() \n",
    "results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'faceset_token': 'cb7f863b735795ca34a082dcb73c274b',\n",
       " 'time_used': 166,\n",
       " 'face_count': 0,\n",
       " 'face_added': 0,\n",
       " 'request_id': '1611838270,975e491a-1515-4383-8549-1b195b7f1560',\n",
       " 'outer_id': '20201018',\n",
       " 'failure_detail': []}"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "api_secret = \"khpW_PQQn7DjpDvL4JDDx2sJnwW47941\"\n",
    "api_key = 'uOKbPAO1um1wo1AE6aLssP6Qr3AkWYB_'\n",
    "\n",
    "# 1.FaceSet Create\n",
    "import requests,json\n",
    "\n",
    "display_name = \"人脸集合1018\" #自定义人脸集合的名字\n",
    "outer_id = \"20201018\" #自定义标识\n",
    "user_data = \"test\" #自定义用户信息\n",
    "\n",
    "CreateFace_Url = \"https://api-cn.faceplusplus.com/facepp/v3/faceset/create\" #调用URL\n",
    "payload = {\n",
    "    # 请求参数\n",
    "    'api_key': api_key,\n",
    "    'api_secret': api_secret,\n",
    "    'display_name':display_name,\n",
    "    'outer_id':outer_id,\n",
    "    'user_data':user_data\n",
    "}\n",
    "r = requests.post(CreateFace_Url, params=payload)\n",
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'faceset_token': 'cb7f863b735795ca34a082dcb73c274b',\n",
       " 'tags': '',\n",
       " 'time_used': 99,\n",
       " 'user_data': 'test',\n",
       " 'display_name': '人脸集合1018',\n",
       " 'face_tokens': [],\n",
       " 'face_count': 0,\n",
       " 'request_id': '1611838287,38c5e5f1-877a-4ec0-8ea3-83a97b31968e',\n",
       " 'outer_id': '20201018'}"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 2.FaceSet GetDetail（获取人脸集合信息）\n",
    "GetDetail_Url = \"https://api-cn.faceplusplus.com/facepp/v3/faceset/getdetail\"\n",
    "payload = {\n",
    "    'api_key': api_key,\n",
    "    'api_secret': api_secret,\n",
    "    'outer_id':outer_id,\n",
    "}\n",
    "r = requests.post(GetDetail_Url,params=payload)\n",
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'time_used': 59,\n",
       " 'error_message': 'INVALID_FACESET_TOKEN',\n",
       " 'request_id': '1611838336,0a5c9485-db82-4240-9e7c-b3aab9f4ee25'}"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 3.FaceSet AddFace（增加人脸信息）\n",
    "AddFace_url = \" https://api-cn.faceplusplus.com/facepp/v3/faceset/addface\"\n",
    "\n",
    "payload = {\n",
    "    'api_key': api_key,\n",
    "    'api_secret': api_secret,\n",
    "    'faceset_token':'52ed3456d1211f0ec0387f413ef998aa',\n",
    "    'face_tokens':'1aff0090208b37e2f8de321a8e2e96c7', # 前面的\n",
    "}\n",
    "r = requests.post(AddFace_url,params=payload)\n",
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'time_used': 77,\n",
       " 'error_message': 'INVALID_FACESET_TOKEN',\n",
       " 'request_id': '1611838348,ad195034-6525-438d-9f7a-c60eba5d0c13'}"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 4.FaceSet RemoveFace（移除人脸信息）\n",
    "RemoveFace_url = \" https://api-cn.faceplusplus.com/facepp/v3/faceset/removeface\"\n",
    "\n",
    "payload = {\n",
    "    'api_key': api_key,\n",
    "    'api_secret': api_secret,\n",
    "    'faceset_token':'52ed3456d1211f0ec0387f413ef998aa',\n",
    "    'face_tokens':'1aff0090208b37e2f8de321a8e2e96c7',\n",
    "}\n",
    "r = requests.post(RemoveFace_url,params=payload)\n",
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'time_used': 72,\n",
       " 'error_message': 'INVALID_FACESET_TOKEN',\n",
       " 'request_id': '1611838365,fc484f9c-3da6-4595-bc99-1e1e449602da'}"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 5.FaceSet Update（更新人脸集合信息）\n",
    "Update_url = \"https://api-cn.faceplusplus.com/facepp/v3/faceset/update\"\n",
    "payload = {\n",
    "    'api_key': api_key,\n",
    "    'api_secret': api_secret,\n",
    "    'faceset_token':'52ed3456d1211f0ec0387f413ef998aa',\n",
    "    'user_data':\"Test.\",\n",
    "}\n",
    "r = requests.post(Update_url,params=payload)\n",
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'faces1': [{'face_rectangle': {'width': 824,\n",
       "    'top': 871,\n",
       "    'left': 1114,\n",
       "    'height': 824},\n",
       "   'face_token': '408a2e24298392530414b25adac30496'}],\n",
       " 'faces2': [{'face_rectangle': {'width': 86,\n",
       "    'top': 91,\n",
       "    'left': 65,\n",
       "    'height': 86},\n",
       "   'face_token': 'd3cae5dde210512e8ead6a778a6a3afa'}],\n",
       " 'time_used': 1973,\n",
       " 'thresholds': {'1e-3': 62.327, '1e-5': 73.975, '1e-4': 69.101},\n",
       " 'confidence': 26.085,\n",
       " 'image_id2': 'g6kg8zfyOouG6ftP+GvEfg==',\n",
       " 'image_id1': 'KIOXEC2V/MyL4zuopAcNig==',\n",
       " 'request_id': '1611838374,0d5f33d8-5f8d-4f5a-967d-f6d0a7a192ab'}"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 6.Compare Face（对比人脸相似度）\n",
    "liudehua01 = \"https://gss0.baidu.com/9fo3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/7c1ed21b0ef41bd57f7f20ff57da81cb39db3d89.jpg\"\n",
    "liudehua02 = \"https://tse3-mm.cn.bing.net/th/id/OIP.Xz3HbYZeNrdUnGJ7vXNzsQHaKO?pid=Api&rs=1\"\n",
    "wangzulan = \"https://tse3-mm.cn.bing.net/th/id/OIP.ZnXeGoVYT4jQudiPOGZn3QAAAA?pid=Api&rs=1\"\n",
    "\n",
    "Compare_url = \"https://api-cn.faceplusplus.com/facepp/v3/compare\"\n",
    "payload ={\n",
    "    'api_key': api_key,\n",
    "    'api_secret': api_secret,\n",
    "    'image_url1':liudehua01,\n",
    "    'image_url2':wangzulan\n",
    "}\n",
    "r = requests.post(Compare_url,params=payload)\n",
    "r.json()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
